<?php

class Acl extends Zend_Acl
{
    public function __construct()
    {
		//ROLES
        $this->addRole( new Zend_Acl_Role('Invitado'));
        $this->addRole( new Zend_Acl_Role('Registrado'), 'Invitado');
		$this->addRole( new Zend_Acl_Role('Editor'), 'Registrado');
        $this->addRole( new Zend_Acl_Role('Administrador'), 'Editor');
		
		//RECURSOS (CONTROLLERS)
		$this->add( new Zend_Acl_Resource('rss'));
		$this->add( new Zend_Acl_Resource('auth'));
		$this->add( new Zend_Acl_Resource('index'));
		$this->add( new Zend_Acl_Resource('admin'));
        $this->add( new Zend_Acl_Resource('error'));
		
		//PERMISOS
		$this->allow('Invitado', 'rss', null);
		$this->allow('Invitado', 'auth', null);
		$this->allow('Invitado', 'error', null);
		$this->allow('Invitado', 'index', array('index','noticia','noticias','granpremio','apuestas','apostar','calendario','escuderias','estadisticas'));
		
		$this->deny('Invitado','index', array('addcomment','addapuesta'));
		
		$this->allow('Registrado','index', null);
		$this->allow('Registrado','index', array('addcomment','addapuesta'));
		$this->allow('Registrado', 'index', array('addcomment','addapuesta'));
		
		$this->allow('Editor', 'index', null);
		$this->allow('Editor', 'admin', null);
		
		$this->allow('Administrador', null, null);
    }
}